// const {Http} = require("./http");
class Http{
  static baseUrl = "http://192.168.4.247:";
  static http(url){
    return new Promise((resolve,reject)=>{
      wx.request({
        url,
        dataType: "json",
        header: {"content-type":"application"},
        method: "GET",
        responseType: "text",
        success: (result) => {resolve(result)},
        fail: (res) => {reject(res)},
      })
    })
  }
}

class Music extends Http{
  static musicUrl(){
    return this.http(this.baseUrl+'3300/recommend/playlist');
  };
  static detailUrl(id){
    return this.http(this.baseUrl+`3300/songlist?id=${id}`)
  }
  static songReflesh(pageNo,pageSize){
    return this.http(this.baseUrl+`3300/songlist/list?pageNo=${pageNo}&pageSize=${pageSize}`)
  }
}
class cart extends Http{
  static cartUrl(){
    return this.http(this.baseUrl+"5500/cart.json");
  }
}
module.exports = {
  Music,
  cart
}